package com.example.javaui.slice;

import com.example.javaui.ResourceTable;
import com.example.javaui.slice.component.TextSlice;
import com.example.javaui.slice.layout.*;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.media.image.common.Position;

public class LayoutAbilitySlice extends AbilitySlice {
    private Button mBtnDirectionalLayout;
    private Button mBtnDependentLayout;
    private Button mBtnPositionLayout;
    private Button mBtnTableLayout;
    private Button mBtnAdaptiveboxLayout;
    private Button mBtnStackLayout;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_slice_layout);

        mBtnDirectionalLayout = (Button) findComponentById(ResourceTable.Id_btn_directional_layout);
        mBtnDependentLayout = (Button) findComponentById(ResourceTable.Id_btn_dependent_layout);
        mBtnPositionLayout = (Button) findComponentById(ResourceTable.Id_btn_position_layout);
        mBtnTableLayout = (Button) findComponentById(ResourceTable.Id_btn_table_layout);
        mBtnAdaptiveboxLayout = (Button) findComponentById(ResourceTable.Id_btn_adaptivebox_layout);
        mBtnStackLayout = (Button) findComponentById(ResourceTable.Id_btn_stack_layout);

        mBtnDirectionalLayout.setClickedListener((Component component) -> {
            present(new DirectionalLayoutSlice(), new Intent());
        });
        mBtnDependentLayout.setClickedListener((Component component) -> {
            present(new DependentLayoutSlice(), new Intent());
        });
        mBtnPositionLayout.setClickedListener((Component component) -> {
            present(new PositionLayoutSlice(), new Intent());
        });
        mBtnTableLayout.setClickedListener((Component component) -> {
            present(new TableLayoutSlice(), new Intent());
        });
        mBtnAdaptiveboxLayout.setClickedListener((Component component) -> {
            present(new AdaptiveBoxLayoutSlice(), new Intent());
        });
        mBtnStackLayout.setClickedListener((Component component) -> {
            present(new StackLayoutSlice(), new Intent());
        });
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
